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 string | |
from collections import OrderedDict | |
from itertools import count | |
# precision of output points | |
decimals = 2 | |
svg = '''M0,0 L66,0 L66,140 L0,140 L0,0 Z M17.5356193,9.91374504 L7.89629934,9.91374504 L7.89629934,34.6390567 L13.9842872,34.6390567 L13.9842872,27.741635 L17.6136633,27.741635 C21.6461094,27.741635 24.6445573,27.0341777 26.6090071,25.619263 C28.5734569,24.2043483 29.555612,21.9699927 29.5554723,18.9161962 C29.5554723,15.8625389 28.5993435,13.5986987 26.687086,12.1246754 C24.7748285,10.6511862 21.7243396,9.91420937 17.5356193,9.91374504 Z M51.2530562,20.2426569 L40.4040722,20.2426569 L40.4040722,9.91374504 L34.3159446,9.91374504 L34.3159446,34.6392308 L40.4040722,34.6390567 L40.4040722,24.9118057 L51.2530562,24.9118057 L51.2530562,34.6392308 L57.3411838,34.6392308 L57.3411838,9.91374504 L51.2530562,9.91391916 L51.2530562,20.2426569 Z''' | |
def string_to_point_tuple(s): |
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
[ | |
{ "keys": ["ctrl+tab"], "command": "next_view" }, | |
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" } | |
] |
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
[ | |
{ "keys": ["ctrl+tab"], "command": "next_view" }, | |
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" } | |
] |
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 requests | |
from bs4 import BeautifulSoup | |
import re | |
page = requests.get('https://en.wikipedia.org/wiki/List_of_country_calling_codes') | |
soup = BeautifulSoup(page.text, 'html.parser') | |
text = str(soup.find('table', class_='wikitable')) | |
matches = re.findall(r'\+\d+', text) | |
matches = set(matches) |
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
% !TEX TS-program = XeLaTeX | |
% DOCUMENT FORMATTING | |
\documentclass[12pt]{article} | |
\usepackage{fontspec} | |
\usepackage{fullpage} | |
\usepackage{fancyhdr} % better looking title | |
\usepackage[all]{nowidow} | |
% MATH FORMATTING |
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
#!/bin/bash | |
# This is a CodeRunner compile script. Compile scripts are used to compile | |
# code before being run using the run command specified in CodeRunner | |
# preferences. This script is invoked with the following properties: | |
# | |
# Current directory: The directory of the source file being run | |
# | |
# Arguments $1-$n: User-defined compile flags | |
# | |
# Environment: $CR_FILENAME Filename of the source file being run |
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
// -std=c++1z -lsfml-graphics -lsfml-window -lsfml-system -Ofast -ffast-math | |
#import<SFML/Graphics.hpp> | |
#define B b[i++]=x | |
using namespace sf;Sprite q;RenderTexture r;Texture j;Shader d;Event e;long i,w=1300,z=w*w*4,x;int main(){auto*b=new Uint8[z];RenderWindow y(VideoMode(w,w),"");d.loadFromMemory("#define g(A,B)mod(gl_FragCoord.A+B,r.A)\n#define V(A,B)texture2D(t,vec2(g(x,A),g(y,B))/r).r\n#define f float\n#define F(A)for(f A=-1.;A<2.;A++)\nuniform sampler2D t;uniform vec2 r;void main(){f s;F(i)F(j)s+=V(i,j);s=f(s==3.||(V(0.,0.)==1.&&s==4.));gl_FragColor=vec4(s,s,s,1.);}",Shader::Fragment);d.setUniform("r",Vector2f(w,w)),j.create(w,w),r.create(w,w);for(;i<z;i++)x=rand()%2*255,B,B,B,b[i]=255;j.update(&b[0]),q.setTexture(j),r.draw(q),r.display(),q.setTexture(r.getTexture());for(;;){while(y.pollEvent(e))if(e.type==Event::Closed)exit(0);y.draw(q),y.display(),r.draw(q,&d),r.display();}} |
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
#!/bin/bash | |
# This is a CodeRunner compile script. Compile scripts are used to compile | |
# code before being run using the run command specified in CodeRunner | |
# preferences. This script is invoked with the following properties: | |
# | |
# Current directory: The directory of the source file being run | |
# | |
# Arguments $1-$n: User-defined compile flags | |
# | |
# Environment: $CR_FILENAME Filename of the source file being run |
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
alias peers="nmap -sn 192.168.1.0/24|python3 -c $'import sys\n[print(\' \'.j oin(s.split(\' \')[4:]),end=\'\') for s in sys.stdin.readlines()[2::2]]'" |
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
void reverse(char* string, char* buffer, size_t buffer_limit) { | |
if(buffer_limit < 1) { | |
return; | |
} | |
size_t len = strnlen(string, buffer_limit); | |
if(len == 0) { | |
buffer[0] = '\0'; | |
return; | |
} | |
buffer[len] = '\0'; |