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
DROP TABLE IF EXISTS ring_log; | |
CREATE TABLE ring_log ( | |
timestamp INT, | |
data TEXT | |
); | |
CREATE TRIGGER remove_oldest BEFORE INSERT ON ring_log | |
WHEN ( SELECT COUNT(*)>5 FROM ring_log ) | |
BEGIN | |
DELETE FROM ring_log WHERE timestamp in ( SELECT timestamp FROM ring_log LIMIT 1 ); |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]){ | |
FILE *stream; | |
char *line = NULL; | |
size_t len = 0; | |
ssize_t nread; | |
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
DROP TABLE IF EXISTS tb1; | |
DROP TABLE IF EXISTS tb2; | |
DROP TABLE IF EXISTS ch; | |
CREATE TABLE tb1 (a INT, b TEXT); | |
INSERT INTO tb1 VALUES (1,'foo'),(2,'bar'); | |
CREATE TABLE tb2 AS SELECT * FROM tb1; | |
CREATE TABLE ch (choice TEXT); | |
CREATE TRIGGER conditional_1 AFTER INSERT ON ch | |
WHEN new.choice = 'tb1' |
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
function S_n = simpsons(x,f_x) | |
fprintf("FOURS LOOP\n"); | |
n = length(x)-1; | |
h = (x(length(x)) - x(1))/n; | |
%h = (x(n_els) - x(1))/n_els | |
% gather all terms multiplied by 4 | |
fours = 0; | |
for i = 2:2:length(x)-1 | |
fprintf("i:%d | x(i): %f | f_x: %f | 4*f_x: %f \n",i,x(i),f_x(x(i)),4*f_x(x(i))); |
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 | |
get_screen_geometry() | |
{ | |
xwininfo -root | awk '/-geometry/{gsub(/+|x/," ");print $2,$3}' | |
} | |
SCHEMA="org.compiz.core:/org/compiz/profiles/unity/plugins/core/" | |
read screen_width screen_depth <<< "$(get_screen_geometry)" | |
hsize=$(gsettings get $SCHEMA hsize) |
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
/* | |
* Recursively list directories/files through Java, akin to Linux's `ls -R` command. | |
* (c) 2017, KazWolfe. Under MIT license. | |
* | |
* To use, save to `Recurse.java` and compile with `javac Recurse.java`. | |
* Run with `java -cp . Recurse /path/to/operate/on`. Be sure you are passing in a folder. | |
*/ | |
import java.io.File; | |
import java.lang.String; |
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 python | |
# -*- coding: utf-8 -*- | |
# | |
# Author: Serg Kolo , <1047481448@qq.com> | |
# Date: December 23, 2016 | |
# Purpose: Indicator that displays timezone | |
# Written for: http://askubuntu.com/q/863952/295286 | |
# Tested on: Ubuntu 16.04 LTS | |
# |
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 python | |
""" | |
Author: Serg Kolo <1047481448@qq.com> | |
Date: Nov 29 , 2016 | |
Purpose:Script for shutting down Ubuntu system | |
if AC adapter is removed | |
Written for:http://askubuntu.com/q/844193/295286 | |
""" | |
import dbus | |
import time |
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 python3 | |
# Author: Serg Kolo | |
# Date: Oct 3rd, 2016 | |
# Description: Script for aligning the center of | |
# user's active window with the center of the monitor | |
# Tested on: Ubuntu 16.04 | |
from __future__ import print_function | |
from gi.repository import Gdk,Gio |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
int rand_int (int,int); | |
void copy_array(int *,int *,int); | |
void merge(int *,int *,int,int,int); | |
int main() | |
{ | |
int len = 3; |
NewerOlder