Skip to content

Instantly share code, notes, and snippets.

View xxami's full-sized avatar

『lilah』 xxami

  • Bristol, UK
View GitHub Profile
version: '2'
vars:
cc: cc
cflags: -std=c18 -pedantic -Wall -fstack-protector-strong -O2
tasks:
build:
silent: true

Keybase proof

I hereby claim:

  • I am xxami on github.
  • I am lilah (https://keybase.io/lilah) on keybase.
  • I have a public key whose fingerprint is 8049 EB3F 4A30 6E5D 202B 5593 1EEE D9B0 49D7 9049

To claim this, I am signing this object:

@xxami
xxami / conemu_mintty-cygwin_cd_integration.txt
Created December 23, 2015 12:43
conemu context integration for launching mintty/cygwin at the current directory
enter following as integration command in conemu settings:
c:\cygwin64\bin\mintty.exe /bin/sh -lc 'cd "$(cygpath "${%ConEmuWorkDir%}")"; exec bash'
@xxami
xxami / csharp_win_print_pdf.cs
Last active March 29, 2024 13:38
C# example of printing pdf - Windows
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Printing;
using System.Diagnostics;
using System.Printing;
using System.IO;
using System.Threading;
@xxami
xxami / quick_easy_sql_query.php
Created February 15, 2015 20:01
quick and easy sql queries in php
$connection = null; /* should be initialized only when needed in query() */
/**
* sql query result object
* easily iterate/re-iterate from a query() call
*/
class QueryResult {
private $sql_result;
public function __construct($sql_result) {
@xxami
xxami / js_encode_utf-8.md
Last active August 29, 2015 14:14
javascript encode utf-8

##encode

console.log(unescape(encodeURIComponent("string to be encoded")));

##with escape formatting

console.log(encodeURIComponent("string to be encoded").replace(/%.{2}/g, function(v) { return "\\x" + v.substring(1, 3).toLowerCase(); }));

this will be displayed, formatted with \x for use as escape sequences in various languages

@xxami
xxami / vim_4_space_tabs.md
Last active August 29, 2015 14:14
vim 4 space tabs

##vim

set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab

##vim via html file

<!-- vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab: -->

note: putting it before DOCTYPE will cause problems with IE (quirks mode)

@xxami
xxami / js_update_on_text_change.html
Last active August 29, 2015 14:14
javascript update on text field change
<input type="text" onchange="var that=this;setTimeout(function(){do_this(that.value);},50);" onkeypress="this.onchange();" onpaste="this.onchange();" oncut="this.onchange();" oninput="this.onchange();">
<script type="text/javascript">
function do_this(value) {
console.log(value);
}
</script>
@xxami
xxami / keyboard_mouse_config.md
Created January 17, 2015 19:39
remove mouse acceleration, increase keyboard input repeat delay, disable/rebind capslock on x / linux ubuntu 14.10

remove mouse acceleration

find your mouse in xinput --list

me:~$ xinput --list
⎡ Virtual core pointer
⎜   ↳ Logitech Gaming Mouse G400

mine is "Logitech Gaming Mouse G400"

edit the file as follows: vim /usr/share/X11/xorg.conf.d/50-mouse-acceleration.conf

@xxami
xxami / auto_authenticate_git_and_hg_linux_ubuntu_14.10.md
Last active August 29, 2015 14:13
make git and hg remember user/passwords for github/bitbucket over https on linux ubuntu 14.10

plain-text

methods mentioned here are not secure as passwords must be stored in plain-text. for careless people only:

git on github

adding auth info to ~/.netrc works well (create if not exist)

machine github.com
login yourusername
password yourpassword