This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba import njit | |
import numpy as np | |
@njit('c8(c8,u8)') | |
def rising_poch(x, n): | |
p = 1+0j | |
for k in range(n): | |
p *= (x+k) | |
return p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymatgen import Structure | |
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer | |
import seekpath | |
import json | |
structure = Structure.from_file('diamond.cif') | |
# spglib primitive cell | |
sga = SpacegroupAnalyzer(structure) | |
structure = sga.find_primitive() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import numpy as np | |
from scipy.optimize import linear_sum_assignment | |
with open('A-small-practice.in', 'rt') as f: | |
T = int(next(f)) | |
for t in range(T): | |
dice = [] | |
N = int(next(f)) | |
for n in range(N): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import numpy as np | |
import torch.optim as optim | |
from torch.autograd import Variable | |
# (1, 0) => target labels 0+2 | |
# (0, 1) => target labels 1 | |
# (1, 1) => target labels 3 | |
train = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://news.ycombinator.com | |
ruby scraper.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Node { | |
Text(String), | |
Element(String, Vec<Node>) | |
} | |
impl Node { | |
fn stringify(&self) -> String { | |
match *self { | |
Text(s) => s, | |
Element(name, nodes) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A web structure adventure | |
#![license = "MIT"] | |
// Disable warning about parser imports | |
#![allow(dead_code)] | |
#![allow(unused_imports)] | |
// Enable peg_syntax_ext phase | |
#![feature(phase)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate simhash; | |
use std::sync::Future; | |
/// DOM Tree | |
pub struct Tree { | |
html: String, | |
pub hash: Future<u64> | |
} | |
impl Tree { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OUT=reports | |
mkdir -p $OUT/$1 | |
nm $1 > $OUT/$1/nm.asm | |
otool -Vt $1 > $OUT/$1/text.asm | |
otool -V -s __TEXT __cstring $1 > $OUT/$1/cstring.asm | |
xxd -a $1 > $OUT/$1/xxd.hex | |
echo "Analysing of $1 finished" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns overtour.core | |
(:use [overtone.live] | |
[overtone.inst.piano])) | |
(defn -main [& args] | |
(piano (note :g4)) | |
(println "Piano ready!")) | |
; Random number between l and h (l inclusive, h exclusive) | |
(defn rand-between [l h] |
NewerOlder