book : The Elements of Computing Systems
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
# find mkcert ca path | |
# mkcert -CAROOT | |
# running local tunnel with local https server (nginx), using self signed certificates (mkcert), | |
lt --local-host api.dot.test --port 443 --subdomain dotapi --local-key /home/rashi/src/local-ssl-keys/_wildcard.dot.test+4-key.pem --local-ca /home/rashi/.local/share/mkcert/rootCA.pem --local-cert /home/rashi/src/local-ssl-keys/_wildcard.dot.test+4.pem --local-https true |
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
#! /usr/bin/python | |
import sys | |
from subprocess import call | |
import os.path | |
dest_ext = "ogg" | |
def convert(source): | |
print("Source: " + source) | |
extension = source[-3:] |
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 flask import Flask | |
from werkzeug.routing import BaseConverter | |
app = Flask(__name__) | |
class RegexConverter(BaseConverter): | |
def __init__(self, url_map, *items): | |
super(RegexConverter, self).__init__(url_map) | |
self.regex = items[0] |
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
<?php | |
if (isset($_POST['name'])) { | |
header('Content-type: application/json'); | |
if ($_POST['name'] != 'hi') { | |
$array = ['result' => 'fail', 'data' => '100']; | |
} else { | |
$array = ['result' => 'success', 'data' => '100']; | |
} | |
die(json_encode($array)); |
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
#!/usr/bin/env ruby | |
require "fileutils" | |
(puts "Usage: #{File.basename $0} widthxheight"; exit 0) if ARGV.size != 1 | |
width, height = ARGV[0].split("x").collect(&:to_i) | |
(puts "Please enter a valid size."; exit 0) if ((width.to_i == 0) or (height.to_i == 0)) | |
half_width = width / 2 | |
FileUtils.cd("images") do | |
Dir['**/*'].each do |f| |
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
// ==UserScript== | |
// @name so | |
// @namespace ALL | |
// @version 1 | |
// @grant none | |
// @include http://sanchaya.lsgkerala.gov.in/assessment/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js | |
// @require https://greasyfork.org/scripts/1003-wait-for-key-elements/code/Wait%20for%20key%20elements.js?version=49342 | |
// ==/UserScript== | |
// ==UserScript== |
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
<?php | |
class User_model extends CI_Model { | |
function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* authenticate user login |
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
#1 schools | |
select | |
RM.rev_district_name, | |
count(CASE WHEN SD.class_end IN (4, 5) and S.school_type='G' THEN SD.school_code END ) AS GovPrimarySchools, | |
count(CASE WHEN SD.class_end IN (4, 5) and S.school_type='A' THEN SD.school_code END ) AS AidPrimarySchools, | |
count(CASE WHEN SD.class_end IN (4, 5) and S.school_type='U' THEN SD.school_code END ) AS AidPrimarySchools, | |
count(CASE WHEN SD.class_end =7 and S.school_type='G' THEN SD.school_code END ) AS GovUpperPrimarySchools, | |
count(CASE WHEN SD.class_end =7 and S.school_type='A' THEN SD.school_code END ) AS AidUpperPrimarySchools, | |
count(CASE WHEN SD.class_end =7 and S.school_type='U' THEN SD.school_code END ) AS AidUpperPrimarySchools, | |
count(CASE WHEN SD.class_end IN (8, 9, 10) and S.school_type='G' THEN SD.school_code END ) AS GovSecondarySchools, |
NewerOlder