Skip to content

Instantly share code, notes, and snippets.

@dokato
dokato / orthogonalization.py
Created February 15, 2018 14:13
Find closest orthogonal matrix
import numpy as np
def find_closest_orthogonal_matrix(A):
'''
Find closest orthogonal matrix to *A* using iterative method.
Bases on the code from REMOVE_SOURCE_LEAKAGE function from OSL Matlab package.
Args:
A (numpy.array): array shaped k, n, where k is number of channels, n - data points
@imAliAzhar
imAliAzhar / emoji-list
Last active January 15, 2023 17:59
Create an Emoji selector menu with Rofi
<span lang="face with tears of joy"> 😂 </span>
<span lang="grinning face with smiling eyes"> 😄 </span>
<span lang="grinning face with sweat"> 😅 </span>
<span lang="face with rolling eyes"> 🙄 </span>
<span lang="smirking face"> 😏 </span>
<span lang="smiling face with halo"> 😇 </span>
<span lang="grinning face"> 😀 </span>
<span lang="squinting face with tongue"> 😝 </span>
<span lang="grinning face with big eyes"> 😃 </span>
<span lang="unamused face"> 😒 </span>
@msmuenchen
msmuenchen / gist:9318327
Last active September 18, 2022 21:53
KeePass v2.x (KDBX v3.x) file format
Convention: Byte array notation as it would appear in a hexeditor.
= Layout=
KDBX files, the keepass database files, are layout as follows:
1) Bytes 0-3: Primary identifier, common across all kdbx versions:
private static $sigByte1=[0x03,0xD9,0xA2,0x9A];
2) Bytes 4-7: Secondary identifier. Byte 4 can be used to identify the file version (0x67 is latest, 0x66 is the KeePass 2 pre-release format and 0x55 is KeePass 1)
@douglasrizzo
douglasrizzo / inconsistent-authors-bib.ipynb
Last active June 27, 2022 00:19
Merging inconsistent author names in a bib file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Create private networks with libvirt

I assume that you have a running debian wheezy host with libvirt and qemu/kvm installed. You need two guest VMs for this. The first guest will get the IP 192.168.100.2 and the second will get 192.168.100.100. All following commands must be run with sudo or under root.

Internal Network

We create a new network named internal with libvirt and use it with the IP

@charveey
charveey / 51-noto-color-emoji.conf
Created October 1, 2017 01:14
Enabling Color Emoji in Chrome (Linux)
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
You need Noto Color Emoji installed in your machine.
Save this file in ~/.config/fontconfig/conf.d/ or /etc/fonts/conf.d/ (system-wide)
-->
<fontconfig>
<match target="scan">
<test name="family">
@arkon
arkon / patch_boot.sh
Last active March 13, 2019 08:45
Bash scripts for patching boot.img/build.prop for Fate/Grand Order on LineageOS (https://goo.gl/YkHgjZ)
#!/usr/bin/env bash
#
# This script replaces "ro.debuggable=1" with "ro.debuggable=0" in the
# default.prop file in a ROM's boot.img and gives you the patched boot.img.
#
# Prerequisites:
# - A UNIX system (with `unzip`)
# - These tools added to your PATH:
# - Android dev tools (adb/fastboot)
# - Various tools in "bootimg_tools_7.8.13.zip" from https://goo.gl/48Sszu
@CalebFenton
CalebFenton / DexFileFingerprinter.java
Created September 28, 2017 17:27
Fingerprinting / Hashing Dalvik Executables
import gnu.trove.map.TObjectLongMap;
import gnu.trove.map.hash.TObjectLongHashMap;
import org.jf.dexlib2.Opcode;
import org.jf.dexlib2.iface.ClassDef;
import org.jf.dexlib2.iface.DexFile;
import org.jf.dexlib2.iface.Field;
import org.jf.dexlib2.iface.Method;
import org.jf.dexlib2.iface.MethodImplementation;
import org.jf.dexlib2.iface.instruction.Instruction;
@moxus
moxus / gist:7789b93119df777465ea
Created July 5, 2015 09:34
Decrypt KeePass files
/* global Buffer */
/**
* Decrypt KeePass files
*
* There are some sources where you can find description about the keepass file format
* https://gist.githubusercontent.com/msmuenchen/9318327/raw/f6cbc07c01297f129700b7e14e1013253ab8b44f/gistfile1.txt
* http://blog.sharedmemory.fr/en/2014/04/30/keepass-file-format-explained/
*/