Skip to content

Instantly share code, notes, and snippets.

View lettergram's full-sized avatar
🕶️
Loading...

Austin Walters lettergram

🕶️
Loading...
View GitHub Profile
#include <stdio.h>
void printArray(int * array, int size){
int i;
printf("[ ");
for (i = 0; i < size; i++)
printf("%d ", array[i]);
printf("]\n");
}
CryptoJS.enc.u8array = {
stringify: function (wordArray) {
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
var u8 = new Uint8Array(sigBytes);
for (var i = 0; i < sigBytes; i++) {
var byte = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
u8[i]=byte;
}
@lettergram
lettergram / fix_elasticbeanstalk_for_rails6.config
Last active May 5, 2022 03:44
ebextension to enable rails 6
commands:
01_install_yarn:
command: "sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo && curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash - && sudo yum install yarn -y"
02_download_nodejs:
command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -"
03_install_nodejs:
command: "yum -y install nodejs"
04_mkdir_webapp_dir:
command: "mkdir /home/webapp"
/**
* Producer-Comsumer example, written in C++ May 4, 2014
* Compiled on OSX 10.9, using:
* g++ -std=c++11 producer_consumer.cpp
**/
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
@lettergram
lettergram / grub
Created July 24, 2020 13:34
/etc/default/grub
# Resume UUID set to enable hybernation, will write RAM to swap
GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=<PARTITION UUID> loglevel=3 quiet"
@lettergram
lettergram / sleep.conf
Created July 24, 2020 04:34
/etc/systemd/sleep.conf
[Sleep]
suspend=suspend-then-hibernate
HibernateState=disk
# Suspend then Hibernate after 45 min
HibernateDelaySec=2700
@lettergram
lettergram / logind.conf
Last active July 24, 2020 04:33
/etc/systemd/logind.conf
[Login]
HandlePowerKey=suspend-then-hibernate
HandleLidSwitch=suspend-then-hibernate
@lettergram
lettergram / powertop.service
Last active July 24, 2020 04:00
/etc/systemd/system/powertop.service
[Unit]
Description=Powertop tunings
[Service]
Type=oneshot
ExecStart=/usr/bin/powertop --auto-tune
[Install]
WantedBy=multi-user.target
publication_title = bs.find('invention-title').text
publication_num = bs['file'].split("-")[0]
publication_date = bs.find('publication-reference').find('date').text
application_type = bs.find('application-reference')['appl-type']
classifications = []
for classes in bs.find_all('classifications-ipcr'):
for el in classes.find_all('classification-ipcr'):
cclassifications.append(el.find('section').text
+ el.find('class').text
# Load USPTO .xml document
xml_text = html.unescape(open(filename, 'r').read())
# Split out patent applications / grants
for patent in xml_text.split("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"):
# Skip if it doesn't exist
if patent is None or patent == "":
continue