Skip to content

Instantly share code, notes, and snippets.

@kamawanu
kamawanu / dict2list.py
Created October 9, 2011 13:05
dict2list
#!python
def dict2list(dict1):
assert isinstance(dict1,dict)
indexes = sorted(dict1.keys())
## try:
[ int(xx) for xx in indexes ] # validation: all keys is integer
assert indexes[0] == 0 and indexes[-1] == len(indexes)-1, "can not convert to list"
return [ dict1[xx] for xx in indexes ]
@kamawanu
kamawanu / fstab_creater.sh
Created December 26, 2010 11:01
append fstab from current mount
#!/bin/bash -x
# https://gist.github.com/755352
for DEV in $( mount | awk '{print $1}'|fgrep /dev/ )
do
PUREDEV=$( echo $DEV | cut -d/ -f3- )
UUIDIS=$( ls -l /dev/disk/by-uuid/ | fgrep $PUREDEV | awk '{print $8}' )
fgrep $UUIDIS /etc/fstab || (
echo $UUIDIS
echo UUID=$UUIDIS $( mount | fgrep $PUREDEV | awk '{print $3,$5}') defaults,noatime 0 0 | sudo tee -a /etc/fstab
)
#!/usr/bin/tclsh
# Optimized Version by Samuel Zafrany
# Ported from C by Anders Bergh <anders1@gmail.com>
package require Tcl 8.4
set BAILOUT 16
set MAX_ITERATIONS 1000
#!/usr/bin/perl
# Ported from C to Perl by Anders Bergh <anders1@gmail.com>
# Some Perlification by John Gabriele (4-24-2007).
use strict;
use warnings;
use Time::HiRes qw( gettimeofday );
my $BAILOUT = 16;
my $MAX_ITERATIONS = 1000;
cfhdojbkjhnklbpkdaibdccddilifddb Adblock Plus 10000000
gighmmpiobklfepjocnamgkkbiglidom AdBlock 10000000
efaidnbmnnnibpcajpcglclefindmkaj Adobe Acrobat 10000000
gomekmidlodglbbmalcneegieacbdmki Avast Online Security 10000000
eofcbnmajmjmplflapaojjnihcjkigck Avast SafePrice 10000000
chfdnecihphmhljaaejmgoiahnihplgn AVG Web TuneUp 10000000
flliilndjeohchalpbbcdekjklbdgfkk Avira Browser Safety 10000000
gpdjojdkbbmdfjfahjcgigfpmkopogic Pin It Button 10000000
lifbcibllhkdhoafpjfnlhfpfgnpldfl Skype 10000000
mallpejgeafdahhflmliiahjdpgbegpk FromDocToPDF 9298905
@kamawanu
kamawanu / .hgrc
Last active September 10, 2021 16:14
[subrepos]
git:allowed=true
[web]
push_ssl=False
allow_push=*
@kamawanu
kamawanu / erlang.rst
Created April 8, 2021 17:18 — forked from voluntas/erlang.rst
実践 Erlang/OTP コトハジメ 2014.11

実践 Erlang/OTP コトハジメ 2014.11

更新

2014-11-20

バージョン

0.0.5

作者

@voluntas

URL

http://voluntas.github.io/

概要

= Arch Linux step-by-step installation =
= http://blog.fabio.mancinelli.me/2012/12/28/Arch_Linux_on_BTRFS.html =
== Boot the installation CD ==
== Create partition ==
cfdisk /dev/sda
* Create a partition with code 8300 (Linux)
@kamawanu
kamawanu / _readme.md
Created December 19, 2020 18:26 — forked from stecman/_readme.md
Brother P-Touch PT-P300BT bluetooth driver python

Controlling the Brother P-Touch Cube label maker from a computer

The Brother PTP300BT label maker is intended to be controlled using the official Brother P-Touch Design & Print iOS/Android app. The app has arbitrary limits on what you can print (1 text object and up to 3 preset icons), so I thought it would be a fun challenge to reverse engineer the protocol to print whatever I wanted.

Python code at the bottom if you want to skip the fine details.

Process

Intitially I had a quick peek at the Android APK to see if there was any useful information inside. The code that handles the communication with the printer in Print&Design turned out to be a native library, but the app clearly prepares a bitmap image and passes it to this native library for printing. Bitmaps are definitely something we can work with.

@kamawanu
kamawanu / countries_codes_and_coordinates.csv
Created August 12, 2020 14:39 — forked from tadast/countries_codes_and_coordinates.csv
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude
Country Alpha-2 code Alpha-3 code Numeric code Latitude (average) Longitude (average)
Afghanistan AF AFG 4 33 65
Albania AL ALB 8 41 20
Algeria DZ DZA 12 28 3
American Samoa AS ASM 16 -14.3333 -170
Andorra AD AND 20 42.5 1.6
Angola AO AGO 24 -12.5 18.5
Anguilla AI AIA 660 18.25 -63.1667
Antarctica AQ ATA 10 -90 0
Antigua and Barbuda AG ATG 28 17.05 -61.8