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
SELECT A.id, A.name, С.value | |
FROM apps AS A | |
LEFT JOIN link AS B | |
ON A.link_id=B.id | |
LEFT JOIN templates AS C | |
ON B.id=C.link_id | |
WHERE C.value IS NOT NULL |
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
>>> class rdict(dict): | |
... __missing__ = lambda self, key:self.setdefault(key, type(self)()) | |
... | |
>>> d = rdict() | |
>>> d[1][2][3][4][5] = 'abc' | |
>>> d[1][2][3]['a']['b'] = 'def' | |
>>> d | |
{1: {2: {3: {4: {5: 'abc'}, 'a': {'b': 'def'}}}}} | |
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
# dpkg -l |grep glfw | |
ii libglfw3:amd64 3.0.4-1 amd64 portable library for OpenGL, window and input (libraries) | |
ii libglfw3-dev:amd64 3.0.4-1 amd64 portable library for OpenGL, window and input (development files) |
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
def isgameover(self): | |
player1 = self.game.player1 | |
player2 = self.game.player2 | |
if (player1 and player2) is None: | |
raise Exception("Not initialized players") | |
for barisan in self.enumseq(): | |
if self.iscontainfive(barisan, player1): | |
return True | |
if self.iscontainfive(barisan, player2): |
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
>>> foo = dict([v, k] for k, v in enumerate(["HELO", "INSERT", "REMOVE", "QUIT"])) | |
>>> foo | |
{'INSERT': 1, 'HELO': 0, 'REMOVE': 2, 'QUIT': 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
function test(x, y){ | |
var arg = arguments; | |
return function(z){ console.log(arg[0], arguments[0]);}; | |
} | |
var a = test(1,2); | |
a(3) | |
>> 1 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
Section "Device" | |
Identifier "Device0" | |
Driver "nvidia" | |
VendorName "NVIDIA Corporation" | |
BoardName "GeForce 9600 GT" | |
BusID "PCI:1:0:0" | |
# Screen 0 | |
EndSection |
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
sakal@sakal:~$ xrandr -q | |
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 8192 x 8192 | |
VGA-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm | |
1920x1080 60.0*+ 59.9 | |
1920x1200 60.0 | |
1680x1050 60.0 59.9 | |
1600x1200 60.0 | |
1440x900 59.9 | |
1400x1050 60.0 | |
1360x768 60.0 59.8 |
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
src = [{"id":1, "value":2}, {"id":3, "value":4}] | |
tmp_list = [] | |
for item in src: | |
tmp_list.append({"id": item["id"], "value": item["value"]}) | |
result = tuple(tmp_list) |
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 "class_a.h" | |
A::A(void) { | |
} | |
A::~A(void) { | |
} |