This file contains hidden or 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/python3 | |
import re | |
n = int(input().strip()) | |
s = "{0:b}".format(n) | |
out = max(len(a) for a in re.findall(r'1+', s)) | |
print(out) |
This file contains hidden or 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
#!/usr/bin/env python3 | |
""" | |
Essentially just a python script to run the sql command below. | |
mysqlimport --ignore-lines=1 --fields-terminated-by=, --columns=csv_headers --local -u root -p db_name file.csv | |
""" | |
This file contains hidden or 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 glob | |
files = glob.glob("*.csv") | |
header_saved = False | |
with open('output.csv', 'w') as fout: | |
for file in files: | |
with open(file) as fin: | |
header = next(fin) | |
if not header_saved: |
This file contains hidden or 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
using System; | |
public class HelloWorld | |
{ | |
private const string Greetings = "Hello, World!"; | |
public string Hello() | |
{ | |
return Greetings; | |
} |
This file contains hidden or 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
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
main() { | |
echo "Hello, World!" | |
} | |
main |
This file contains hidden or 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 hello-world) | |
(defn hello [] "Hello, World!" ) |
This file contains hidden or 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
using System; | |
public static class Leap | |
{ | |
public static bool IsLeapYear(int year) | |
{ | |
bool multipleOf4 = YearIsDivisibleByFactor(year, 4); | |
bool multipleOf100 = YearIsDivisibleByFactor(year, 100); | |
bool multipleOf400 = YearIsDivisibleByFactor(year, 400); |
This file contains hidden or 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
# This command would be run from the parent folder that: | |
# 1. contains the file(s) to be converted | |
# 2. has subdirectories that contain files to be converted | |
# 3. both of the above. | |
# This example finds all .tif files and converts them to .pdf, | |
# but any conversion supported by ImageMagick could be used here. | |
# If you don't have ImageMagick installed, you can do so here (https://imagemagick.org/script/download.php) | |
# for linux |
This file contains hidden or 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
require('dotenv').config(); | |
const { AsyncParser } = require('json2csv'); | |
const fs = require('fs'); | |
const MongoClient = require('mongodb').MongoClient; | |
const url = `mongodb://localhost:27017`; | |
const HEADERS = ['first_name', 'last_name', 'middle_name', 'id']; | |
const FIELDS = ['name.first_name', 'name.last_name', 'name.middle_name', 'id']; |
This file contains hidden or 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
#!/usr/local/bin/python3 | |
# List tasks with fab2 -l | |
import os | |
import os.path as path | |
from fabric2 import Config, Connection, task | |
import patchwork.transfers as transfer | |
# Define values in .env file. |