Skip to content

Instantly share code, notes, and snippets.

@Jyang772
Jyang772 / 105
Last active September 26, 2019 06:12
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
@Jyang772
Jyang772 / s1.py
Last active September 1, 2018 00:22
from sklearn.ensemble import RandomForestRegressor
import numpy as np
def initialize(context):
#context.security = sid(8554) # Trade SPY
context.security = symbol('GNW')
context.model1 = RandomForestRegressor()
context.model2 = RandomForestRegressor()
context.model3 = RandomForestRegressor()
context.model4 = RandomForestRegressor()
https://cdn-images-1.medium.com/max/660/1*WgROsTKa6diRYTG5K0R5mw.jpeg
http://scruss.com/wordpress/wp-content/uploads/2013/06/random20130606210630.png
https://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Two_red_dice_01.svg/220px-Two_red_dice_01.svg.png
https://cdn-images-1.medium.com/max/1600/1*t_G1kZwKv0p2arQCgYG7IQ.gif
https://vignette.wikia.nocookie.net/austinally/images/1/14/Random_picture_of_shark.png/revision/latest?cb=20150911004230
http://www.lozano-hemmer.com/image_sets/method_random/method_random2.jpg
https://openclipart.org/download/232694/Pattern20a.svg
https://i.pinimg.com/originals/f5/9b/1b/f59b1b0cc430702e82dea90780d7f87d.gif
https://cdn.dribbble.com/users/815278/screenshots/2375130/random-turtle.gif
https://media.boingboing.net/wp-content/uploads/2016/08/pandyland.jpg
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class 3Sum
{
static HashSet<int[]> res = new HashSet<int[]>();
public static void main (String[] args) throws java.lang.Exception
/* free block with user-pointer p (block actually starts at p - TAGSIZE) */
void freef(char *p)
{
/* you write the code for the freef function here */
printf("freef called with p=%p\n", (void *) p);
if(p < allocbuf || p > allocbuf + ALLOCSIZE) {
printf("freef: BAD POINTER!, %p\n", (void*)p);
return;
if ! [[ -z "$1" ]]; then
ps aux | grep $1 | awk {'print $2'} | xargs kill -9
else
echo "Not set"
fi
pizza=$(echo "xxx yyy
xxx yyy" | awk '{ if($2 == "yyy") print $2}')
Awk tries to match pattern in every line. Then outputs $2 to variable 'pizza', concatenating the entries.
#!/bin/sh
module="TITS"
device="TITS"
@Jyang772
Jyang772 / gist:12c11b4863c06a83bbc9
Created January 15, 2015 07:23
Changing Audio/Input Devices
#List audio sinks
pacmd list-sinks
#Change default from monitor to USB (0 --> 1)
pacmd set-default-sink 1
#Get all input streams
pacmd list-sink-inputs
#Move input stream from ex. 5 to 1
@Jyang772
Jyang772 / hash.cpp
Last active August 29, 2015 14:01
UnHash me
#include <iostream>
using namespace std;
int main()
{
char array[] = "acdegilmnoprstuw";
string result;
long long h = 910897038977002;
for(int i=0; i <9;i++)
for(int j=0; j <16;j++)
@Jyang772
Jyang772 / Toggle.cpp
Last active August 29, 2015 14:01
Toggle
#include <iostream>
using namespace std;
int main()
{
int toggle;
int counter=1; //remember to initialize this. otherwise junk or null. Most likely junk/garbage...GG.
for(int i = 1; i<= 12; i++)
{