Skip to content

Instantly share code, notes, and snippets.

View hodlbirb's full-sized avatar

Dmitry hodlbirb

  • Hong Kong
View GitHub Profile
{
"Guid" : "E9BE065F-0ED9-40A0-ACF6-11D8A620174A",
"Tags" : [
],
"Ansi 12 Color" : {
"Green Component" : 0.5764705882352941,
"Red Component" : 0.7411764705882353,
"Blue Component" : 0.9764705882352941
},
@hodlbirb
hodlbirb / test.py
Created February 3, 2017 11:07
3 digit palindrome. Output: 997 * 997 = 994009
def main():
memo = 0
x = 0
y = 0
for i in range(1, 999):
for j in reversed(range(1,999)):
temp = i * j
s = str(temp)
if (s[0] == s[-1] and temp > memo):
memo = temp
@hodlbirb
hodlbirb / 3 digit polyndrom
Created February 3, 2017 11:03
Output: 994009
def main():
memo = 0
for i in range(1, 999):
for j in reversed(range(1,999)):
temp = i * j
s = str(temp)
if (s[0] == s[-1] and temp > memo):
memo = temp
print(memo)
@hodlbirb
hodlbirb / sqrt.go
Last active January 31, 2017 22:24
Hand-coded sqrt func with tail recursion
package main
import (
"fmt"
"math"
"math/big"
)
func Sqrt(x float64) float64 {
if x == 0 {
#!/bin/bash
# -c file - compress file
# -d file - decompress file
while getopts ":c:d:" opt; do
case $opt in
c ) cut -d' ' -f1,3,4,5,6 $OPTARG | gzip -k -9 > comp.gz;;
d ) gzip -d $OPTARG --stdout | sed -e "s/\([0-9]\{2\}:[0-9]\{2\}\)\(:[0-9]\{2\}\)/\1\2 \1/" > decomp.txt;;
esac
/*
5. The total number of students travelling to a specific country in a multi city
trip operated by a specified coach in given date.
Result should contain both detailed breakup & summary for above mentioned
categories along with overall summary.
*/
SELECT COUNT(student_id) AS `Total number of students`, country_name, vin AS `Coach No`
FROM country
@hodlbirb
hodlbirb / problem.txt
Last active May 1, 2016 18:12
string “weightfoxtourist” represents as 2468
Problem
You just made a new friend at an international puzzle conference,
and you asked for a way to keep in touch. You found the following note
slipped under your hotel room door the next day:
"Salutations, new friend! I have replaced every digit of my phone number
with its spelled-out uppercase English representation ("ZERO", "ONE", "TWO",
"THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE" for the digits
0 through 9, in that order), and then reordered all of those letters in some
Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: Main.Main$1
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1149)
at Main.Main.main(Main.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
@hodlbirb
hodlbirb / Main.java
Last active February 29, 2016 09:13
package Main;
import Model.Person;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
public class Main {
package Model;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity(name = "persons")
public class Person implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)