update wiki
This commit is contained in:
parent
30745d0ae9
commit
093ecc0fe7
|
@ -1792,6 +1792,14 @@ TODO</pre>
|
|||
<div title="No.de" modifier="makefu" created="201106142021" server.type="file" server.host="file:///home/makefu/Downloads/knowledge_base.html" server.page.revision="201106142021">
|
||||
<pre>Type the text for 'No.de'</pre>
|
||||
</div>
|
||||
<div title="OpenSSL" creator="makefu" modifier="makefu" created="201403310706" changecount="1">
|
||||
<pre>! generate a new certificate
|
||||
for example for unrealircd:
|
||||
{{{
|
||||
openssl req -new -x509 -keyout temp.key -out server.cert.pem -days 9001
|
||||
openssl rsa -in temp.key > server.key.pem
|
||||
}}}</pre>
|
||||
</div>
|
||||
<div title="Oracle Database" modifier="makefu" created="201103291115" modified="201302151256" server.type="file" server.host="file:///home/makefu/Downloads/knowledge_base.html" server.page.revision="201302151256">
|
||||
<pre>! Find Oracle Home
|
||||
should be, in most cases, right below {{{bin/sqlplus}}}
|
||||
|
@ -3070,6 +3078,17 @@ iptables -A POSTROUTING -t nat -o $device -j MASQUERADE
|
|||
#iptables -A FORWARD -m state --state NEW,INVALID -i $device -j DROP
|
||||
}}}</pre>
|
||||
</div>
|
||||
<div title="USB" creator="makefu" modifier="makefu" created="201403071436" modified="201403071436" tags="usb" changecount="2">
|
||||
<pre>! Disable one interface
|
||||
|
||||
{{{
|
||||
lsusb
|
||||
lsusb -t
|
||||
# syntax of the id:
|
||||
# <bus>-<port>.<port>.<port>...
|
||||
cd /sys/bus/usb/drivers/usb/1-1.6 ; echo 1 > remove
|
||||
}}}</pre>
|
||||
</div>
|
||||
<div title="UbuntuOne" modifier="makefu" created="201304261132" modified="201307020701" server.type="file" server.host="file:///home/makefu/Downloads/knowledge_base.html" server.page.revision="201307020701">
|
||||
<pre>- to use with [[Duply]]
|
||||
{{{
|
||||
|
@ -3203,19 +3222,20 @@ T0$ ifconfig at0 192.168.0.1 up && dnsmasq -d
|
|||
deb http://ftp.de.debian.org/debian squeeze main non-free contrib
|
||||
}}}</pre>
|
||||
</div>
|
||||
<div title="archlinux" modifier="makefu" created="201307032151" modified="201309231134" server.type="file" server.host="file:///home/makefu/Downloads/knowledge_base.html" server.page.revision="201307032153" changecount="1">
|
||||
<div title="archlinux" modifier="makefu" created="201307032151" modified="201402260955" server.type="file" server.host="file:///home/makefu/Downloads/knowledge_base.html" server.page.revision="201307032153" changecount="3">
|
||||
<pre>! basic install
|
||||
{{{
|
||||
# we are using gpt, not mbr
|
||||
gdisk /dev/sda
|
||||
# create a 2MB grub (EF02) partition and the rest as linux partition(8200)
|
||||
# we are using mbr again, guid somehow does not do the right thing
|
||||
fdisk /dev/sda
|
||||
# create linux partition(8300)
|
||||
n;enter;enter;enter
|
||||
# ... and btrfs because all the cool kids do so
|
||||
mkfs.btrfs /dev/sda2
|
||||
mkdir /mnt/btrfs-root /mnt/active
|
||||
mount /dev/sda2 /mnt/btrfs-root
|
||||
btrfs subvolume create __active && cd __active
|
||||
for i in home var usr ; do btrfs subvolume create $i; done
|
||||
mount /dev/sda2 default,noatime,subvol=__active /mnt/active
|
||||
btrfs subvolume create var
|
||||
mount /dev/sda2 -o default,noatime,subvol=__active /mnt/active
|
||||
|
||||
# install that shit
|
||||
pacstrap /mnt/active base
|
||||
|
|
|
@ -5,16 +5,84 @@
|
|||
<description></description>
|
||||
<language>en</language>
|
||||
<copyright>Copyright 2014 makefu</copyright>
|
||||
<pubDate>Tue, 14 Jan 2014 01:38:28 GMT</pubDate>
|
||||
<lastBuildDate>Tue, 14 Jan 2014 01:38:28 GMT</lastBuildDate>
|
||||
<pubDate>Mon, 31 Mar 2014 07:06:35 GMT</pubDate>
|
||||
<lastBuildDate>Mon, 31 Mar 2014 07:06:35 GMT</lastBuildDate>
|
||||
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
|
||||
<generator>TiddlyWiki 2.8.1</generator>
|
||||
<item>
|
||||
<title>OpenSSL</title>
|
||||
<description><h1> generate a new certificate</h1>for example for unrealircd:<br><pre>openssl req -new -x509 -keyout temp.key -out server.cert.pem -days 9001
|
||||
openssl rsa -in temp.key &gt; server.key.pem
|
||||
</pre></description>
|
||||
<link>null#OpenSSL</link>
|
||||
<pubDate>Mon, 31 Mar 2014 07:06:34 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>USB</title>
|
||||
<description><h1> Disable one interface</h1><br><pre>lsusb
|
||||
lsusb -t
|
||||
# syntax of the id:
|
||||
# &lt;bus&gt;-&lt;port&gt;.&lt;port&gt;.&lt;port&gt;...
|
||||
cd /sys/bus/usb/drivers/usb/1-1.6 ; echo 1 &gt; remove
|
||||
</pre></description>
|
||||
<category>usb</category>
|
||||
<link>null#USB</link>
|
||||
<pubDate>Fri, 07 Mar 2014 14:36:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>archlinux</title>
|
||||
<description><h1> basic install</h1><pre># we are using mbr again, guid somehow does not do the right thing
|
||||
fdisk /dev/sda
|
||||
# create linux partition(8300)
|
||||
n;enter;enter;enter
|
||||
# ... and btrfs because all the cool kids do so
|
||||
mkfs.btrfs /dev/sda2
|
||||
mkdir /mnt/btrfs-root /mnt/active
|
||||
mount /dev/sda2 /mnt/btrfs-root
|
||||
btrfs subvolume create __active &amp;&amp; cd __active
|
||||
btrfs subvolume create var
|
||||
mount /dev/sda2 -o default,noatime,subvol=__active /mnt/active
|
||||
|
||||
# install that shit
|
||||
pacstrap /mnt/active base
|
||||
genfstab -p /mnt/active &gt; /mnt/active/etc/fstab
|
||||
cat &gt;&gt; /mnt/active/etc/fstab&lt;&lt;EOF
|
||||
tmpfs /tmp tmpfs defaults 0 0
|
||||
## to never write persistent, uncomment:
|
||||
#tmpfs /var/log tmpfs defaults 0 0
|
||||
EOF
|
||||
arch-chroot /mnt/active
|
||||
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
||||
echo "LANG=en_US.UTF-8" &gt;&gt; /etc/locale.conf
|
||||
echo "en_US.UTF-8 UTF-8" &gt;&gt; /etc/locale.gen
|
||||
locale-gen
|
||||
echo "my-host" &gt; /etc/hostname
|
||||
mkinitcpio -p linux
|
||||
pacman -S openssh grub-bios
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
passwd
|
||||
# useradd -d /home/bob -m bob
|
||||
cd /etc/netctl
|
||||
cp examples/ethernet-static lan
|
||||
# edit lan , try network: enp0s25 or something
|
||||
netctl enable lan
|
||||
systemctl enable sshd.service
|
||||
grub-install /dev/sda
|
||||
exit
|
||||
reboot
|
||||
</pre></description>
|
||||
<link>null#archlinux</link>
|
||||
<pubDate>Wed, 26 Feb 2014 09:55:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>curl</title>
|
||||
<description><h1> spoof host_name</h1><pre>curl --resolve host:80:ip host
|
||||
</pre></description>
|
||||
<link>null#curl</link>
|
||||
<pubDate>Tue, 14 Jan 2014 01:38:27 GMT</pubDate>
|
||||
<pubDate>Tue, 14 Jan 2014 01:38:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
|
@ -318,7 +386,7 @@ swapon /swapon
|
|||
</item>
|
||||
<item>
|
||||
<title>MainMenu</title>
|
||||
<description><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="GettingStarted" refresh="link" target="_blank" title="External link to null#GettingStarted" href="null#GettingStarted" class="externalLink null">GettingStarted</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Security" refresh="link" target="_blank" title="External link to null#Security" href="null#Security" class="externalLink null">Security</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Hardware" refresh="link" target="_blank" title="External link to null#Hardware" href="null#Hardware" class="externalLink null">Hardware</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Programming" refresh="link" target="_blank" title="External link to null#Programming" href="null#Programming" class="externalLink null">Programming</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Hacking" refresh="link" target="_blank" title="External link to null#Hacking" href="null#Hacking" class="externalLink null">Hacking</a><br><h1> Misc</h1><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="TODO" refresh="link" target="_blank" title="External link to null#TODO" href="null#TODO" class="externalLink null">TODO</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Fun" refresh="link" target="_blank" title="External link to null#Fun" href="null#Fun" class="externalLink null">Fun</a><br><a target="_blank" title="External link to http://euer.krebsco.de/atom.xml" href="http://euer.krebsco.de/atom.xml" class="externalLink">RSS of this Blog</a><br></description>
|
||||
<description><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="GettingStarted" refresh="link" target="_blank" title="External link to null#GettingStarted" href="null#GettingStarted" class="externalLink null">GettingStarted</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Security" refresh="link" target="_blank" title="External link to null#Security" href="null#Security" class="externalLink null">Security</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Hardware" refresh="link" target="_blank" title="External link to null#Hardware" href="null#Hardware" class="externalLink null">Hardware</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Programming" refresh="link" target="_blank" title="External link to null#Programming" href="null#Programming" class="externalLink null">Programming</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Hacking" refresh="link" target="_blank" title="External link to null#Hacking" href="null#Hacking" class="externalLink null">Hacking</a><br><h1> Misc</h1><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="TODO" refresh="link" target="_blank" title="External link to null#TODO" href="null#TODO" class="externalLink null">TODO</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Fun" refresh="link" target="_blank" title="External link to null#Fun" href="null#Fun" class="externalLink null">Fun</a><br><a target="_blank" title="External link to /wiki/knowledge_base.xml" href="/wiki/knowledge_base.xml" class="externalLink">RSS of this Blog</a><br></description>
|
||||
<link>null#MainMenu</link>
|
||||
<pubDate>Thu, 07 Nov 2013 14:12:00 GMT</pubDate>
|
||||
|
||||
|
@ -389,120 +457,6 @@ kill dat-shit
|
|||
<link>null#%5B%5BFile%20Systems%5D%5D</link>
|
||||
<pubDate>Tue, 22 Oct 2013 17:37:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>/etc/network/interfaces</title>
|
||||
<description><h1>static network</h1><pre>auto eth1 # come up automatically
|
||||
iface et1 inet static
|
||||
address 192.168.0.24
|
||||
netmask 255.255.255.0
|
||||
# gateway 192.168.0.23
|
||||
</pre><h1> for wpa_supplicant</h1><pre>auto wlan0
|
||||
allow-hotplug wlan0
|
||||
iface wlan0 inet dhcp
|
||||
wpa-ssid meinessid
|
||||
wpa-psk meinpasswort
|
||||
</pre></description>
|
||||
<category>network</category>
|
||||
<link>null#%2Fetc%2Fnetwork%2Finterfaces</link>
|
||||
<pubDate>Wed, 16 Oct 2013 23:54:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>solaris</title>
|
||||
<description><h1> gnu alternatives</h1><h2> readlink -f</h2><pre>canonicalpath() {
|
||||
if [ -d $1 ]; then
|
||||
pushd $1 &gt; /dev/null 2&gt;&amp;1
|
||||
echo $PWD
|
||||
elif [ -f $1 ]; then
|
||||
pushd $(dirname $1) &gt; /dev/null 2&gt;&amp;1
|
||||
echo $PWD/$(basename $1)
|
||||
else
|
||||
echo "Invalid path $1"
|
||||
fi
|
||||
popd &gt; /dev/null 2&gt;&amp;1
|
||||
}
|
||||
</pre><pre>canonicalize(){
|
||||
cd -P -- "$(dirname -- "$1")" &amp;&amp;
|
||||
printf '%s\n' "$(pwd -P)/$(basename -- "$1")"
|
||||
}
|
||||
</pre><h2> mount -o bind</h2><pre>mount -F lofs DIR1 DIR2
|
||||
</pre></description>
|
||||
<link>null#solaris</link>
|
||||
<pubDate>Wed, 16 Oct 2013 10:59:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>Python Advanced</title>
|
||||
<description><h1> Python for the user</h1>in ~/.profile <br><pre>export PYTHONPATH=~/.local/lib/python2.7/site-packages
|
||||
export PATH=$PATH:~/.local/lbin
|
||||
</pre>then do<br><pre>pip install --user &lt;stuff&gt;
|
||||
</pre><h1> Interactive Shell</h1><h2> Activate Tab Completion</h2><pre>import rlcompleter,readline;readline.parse_and_bind("tab: complete")
|
||||
</pre><h1> Single file Python</h1><h2> py2zip</h2>from <a target="_blank" title="External link to http://people.canonical.com/~roman.yepishev/us/src/" href="http://people.canonical.com/~roman.yepishev/us/src/" class="externalLink">http://people.canonical.com/~roman.yepishev/us/src/</a><br><pre>#!/bin/bash
|
||||
|
||||
ORIG_PWD=$PWD
|
||||
|
||||
set -ex
|
||||
|
||||
TARGET="$1"
|
||||
TARGET_BASENAME=`basename "$TARGET"`
|
||||
shift
|
||||
|
||||
MAIN=$1
|
||||
shift
|
||||
|
||||
FILES="$*"
|
||||
TEMPDIR=`mktemp -d /tmp/XXXXXXXX`
|
||||
|
||||
cp "$MAIN" "$TEMPDIR/__main__.py"
|
||||
cp --parents -r $FILES "$TEMPDIR/"
|
||||
|
||||
cd "$TEMPDIR"
|
||||
zip -q -r build.zip *
|
||||
cd "$ORIG_PWD"
|
||||
echo "#!/usr/bin/python" &gt; "$TEMPDIR/build.header"
|
||||
cat "$TEMPDIR/build.header" "$TEMPDIR/build.zip" &gt; "$TEMPDIR/$TARGET_BASENAME"
|
||||
chmod +x "$TEMPDIR/$TARGET_BASENAME"
|
||||
mv "$TEMPDIR/$TARGET_BASENAME" $TARGET
|
||||
</pre><br><h1>Conditionals</h1><pre>&gt;&gt;&gt; x = 5
|
||||
&gt;&gt;&gt; 1 &lt; x &lt; 10
|
||||
True
|
||||
&gt;&gt;&gt; 10 &lt; x &lt; 20
|
||||
False
|
||||
&gt;&gt;&gt; x &lt; 10 &lt; x*10 &lt; 100
|
||||
True
|
||||
&gt;&gt;&gt; 10 &gt; x &lt;= 9
|
||||
True
|
||||
&gt;&gt;&gt; 5 == x &gt; 4
|
||||
True
|
||||
</pre><h1>Random</h1><pre>from random import random
|
||||
seed() # which seed to use
|
||||
randint(a,b) # int between a and b
|
||||
randrange(start,stop,step) # like choice(range(start,stop,step))
|
||||
hoice(seq) # random choice from sequence
|
||||
shuffle(x) # shuffles sequence
|
||||
sample(seq,num) # choose num samples
|
||||
uniform() # float between a and b
|
||||
</pre><h1>Decorators</h1><pre>
|
||||
def print_args(function):
|
||||
def wrapper(*args, **kwargs):
|
||||
print 'Arguments:', args, kwargs
|
||||
return function(*args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
@print_args
|
||||
def write(text):
|
||||
print text
|
||||
|
||||
&gt;&gt;&gt; write('foo')
|
||||
Arguments: ('foo',){}
|
||||
foo
|
||||
</pre><h1>Advanced Regexes</h1><pre>re.compile("^\[font(?:=(?P&lt;size&gt;[-+][0-9]{1,2}))?\](.*?)[/font]",
|
||||
re.DEBUG)
|
||||
</pre></description>
|
||||
<link>null#%5B%5BPython%20Advanced%5D%5D</link>
|
||||
<pubDate>Fri, 11 Oct 2013 10:00:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
Loading…
Reference in a new issue